﻿<UserControl
    xmlns:uc="clr-namespace:TfsWorkbench.UIElements;assembly=TfsWorkbench.UIElements"
    x:Class="TfsWorkbench.ProjectSetupUI.NodeVisualisation.NodeVisualiser"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:Helpers="clr-namespace:TfsWorkbench.ProjectSetupUI.Helpers" 
    xmlns:Properties="clr-namespace:TfsWorkbench.ProjectSetupUI.Properties" 
    xmlns:PopupControls="clr-namespace:TfsWorkbench.UIElements.PopupControls;assembly=TfsWorkbench.UIElements" 
    Name="PART_NodeVisualiser"
    MinHeight="200"
    MinWidth="350"
    >
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="..\Resources\ProjectSetupTemplates.xaml" />
                <ResourceDictionary Source="/TfsWorkbench.UIElements;Component/Resources/CommandButtonStyles.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>
    <DockPanel>
        <Border Margin="0,0,0,2" DockPanel.Dock="Top" Background="{DynamicResource ToolbarBackground}" Padding="10" CornerRadius="5" Effect="{DynamicResource DropShadowLevel1}">
    		<StackPanel Orientation="Horizontal">
    			<StackPanel Orientation="Horizontal" ToolTip="Scale node view">
    				<TextBlock VerticalAlignment="Center" Margin="0,0,2,0"><Run Text="Scale:"/></TextBlock>
    				<Slider x:Name="PART_ScaleSlider" Width="200" Minimum="0" Maximum="2" Value="1" />
    			</StackPanel>
    			<PopupControls:ComboBoxTreeView 
    				x:Name="PART_NodeFilterControl"
    				Value="{Binding NodeFilter, ElementName=PART_NodeVisualiser, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" 
    				RootNode="{Binding Path=ProjectFilterNode, ElementName=PART_NodeVisualiser}"
    				MinWidth="175" 
                    ToolTip="Set node path filter"
                />
    			<Button 
    				Click="ResetButtonClick" 
    				Style="{DynamicResource RefreshButtonStyle}"
    				Content="Reset" ToolTip="Reset node layout"/>
    			<Button 
    				Command="{x:Static Helpers:LocalCommandLibrary.ShowQuickSetupCommand}"
    				CommandTarget="{Binding ElementName=PART_NodeVisualiser}"
    				Style="{DynamicResource SetupButtonStyle}" 
    				Content="Quick Setup" 
                    ToolTip="Show quick setup panel. Note: Setup is intended for your initial project setup. Right click on nodes for addtional options."
                />
    			<Button 
    				Command="{x:Static Helpers:LocalCommandLibrary.ShowAdvancedSetupCommand}"
    				CommandTarget="{Binding ElementName=PART_NodeVisualiser}"
    				Style="{DynamicResource SetupButtonStyle}" 
    				Content="Advanced Setup" 
                    ToolTip="Show advanced setup panel. Note: Setup is intended for your initial project setup. Right click on nodes for addtional options."
                />
                <Button
                    Command="{x:Static uc:CommandLibrary.SystemShellCommand}"
					CommandTarget="{Binding RelativeSource={RelativeSource Self}}" 
                    CommandParameter="{Binding Source={x:Static Properties:Settings.Default}, Path=HelpPageUrl}"
                    Style="{DynamicResource QuestionButtonStyle}"
                    ToolTip="View the online guidance"
                    />
            </StackPanel>
    	</Border>
        <Border DockPanel.Dock="Top" Margin="0,5,0,0">
            <Grid>
                <TextBlock VerticalAlignment="Top" HorizontalAlignment="Left" FontStyle="Italic" Foreground="{DynamicResource DisplayModeTextColour}" TextWrapping="Wrap" Margin="5">
                    <Run Text="Note: Setup wizards (quick and advanced) are compatible with SfTS v3 templates only."/>
                    <LineBreak />
                    <Run Text="Wizards can only be used when the root iteration path is loaded."/>
                    <LineBreak />
                    <Run Text="Use wizards for your inital setup. Right click on existing path nodes for further options."/>
                    <LineBreak />
                    <Run Text="To scale: Hold [Shift] and use scroll wheel. Hold [Ctrl] and drag to move child nodes."/>
                </TextBlock>
                <ScrollViewer x:Name="PART_LayoutScroller" HorizontalScrollBarVisibility="Auto" Padding="5" PreviewMouseWheel="ScrollViewerPreviewMouseWheel" Background="#01ffffff">
                    <Canvas x:Name="PART_LayoutCanvas" Background="Transparent">
                        <Canvas.LayoutTransform>
                            <ScaleTransform ScaleX="{Binding Value, ElementName=PART_ScaleSlider}" ScaleY="{Binding Value, ElementName=PART_ScaleSlider}" />
                        </Canvas.LayoutTransform>
                    </Canvas>
                </ScrollViewer>
            </Grid>
        </Border>
    </DockPanel>
</UserControl>
